#include "gamma-manager-adaptor.h"

GmAdaptor::GmAdaptor(QObject *parent) :
    QDBusAbstractAdaptor(parent)
{
    // constructor
    setAutoRelaySignals(true);
    qRegisterMetaType<OutputGammaInfo>("OutputGammaInfo");
    qRegisterMetaType<OutputGammaInfoList>("OutputGammaInfoList");
    qDBusRegisterMetaType<OutputGammaInfo>();
    qDBusRegisterMetaType<OutputGammaInfoList>();
}

GmAdaptor::~GmAdaptor()
{

}

int GmAdaptor::setColorTemperature(QString appName, int colorTemp)
{
    int out0;
    USD_LOG(LOG_DEBUG," appName:%s", appName.toLatin1().data());
    QMetaObject::invokeMethod(parent(), "setColorTemperature", Q_RETURN_ARG(int, out0), Q_ARG(int, colorTemp));
    return out0;
}

int GmAdaptor::setScreenBrightness(QString appName,QString screenName, int screenBrightness)
{
    int out0;
    USD_LOG(LOG_DEBUG," appName:%s", appName.toLatin1().data());
    QMetaObject::invokeMethod(parent(), "setScreenBrightness", Q_RETURN_ARG(int, out0),  Q_ARG(QString, screenName), Q_ARG(int, screenBrightness));
    return out0;
}

OutputGammaInfo GmAdaptor::getScreensGamma(QString appName)
{
    OutputGammaInfo out0;
    USD_LOG(LOG_DEBUG," appName:%s", appName.toLatin1().data());
    QMetaObject::invokeMethod(parent(), "getScreensGamma", Q_RETURN_ARG(OutputGammaInfo, out0));
    return out0;
}

OutputGammaInfoList GmAdaptor::getScreensGammaList(QString appName)
{
    OutputGammaInfoList out0;
    USD_LOG(LOG_DEBUG," appName:%s", appName.toLatin1().data());
    QMetaObject::invokeMethod(parent(), "getScreensGammaList", Q_RETURN_ARG(OutputGammaInfoList, out0));
    return out0;
}

QHash<QString, QVariant> GmAdaptor::getScreensGammaInfo()
{
    QHash<QString, QVariant> out0;
//    QMetaObject::invokeMethod(parent(), "getScreensGammaInfo", Q_RETURN_ARG(QHash<QString, QVariant>, out0));
    return out0;
}
